<!-- 整改报告 -->
<template>
  <a-layout class="ant-layout" style="padding: 0">
    <div style="display: flex;flex-direction: row;justify-content: center;margin-top: 30px">
      <div class="datebg" style="display: flex;flex-direction: column;justify-content: center;">
        <div style="display: flex; flex-direction: row; flex-wrap: nowrap; margin-top: 30px">
          <div style="display: flex;flex-grow: 1">
            <DateProgress  :sliderwidth="fbgwidth" :processwidth="fprocess" :maintip="ftip" :mbgcolor="fbgcolor"
                          :dcolor="fdotcolor" :ldate="ftimeStr" :tops="-35"></DateProgress>
          </div>
          <div style="display: flex;flex-grow: 1;" class="pd30">
            <DateProgress :sliderwidth="bbgwidth" :processwidth="bprocess" :maintip="btip" :mbgcolor="bggcolor"
                          :dcolor="bgdotcolor" :ldate="btimeStr" :tops="-35"></DateProgress>
          </div>
          <div style="display: flex;flex-grow: 1; align-items: center" class="pd30">
            <div v-show="!tj_status" style="background-color:#d8d8d8;height: 11.5px;" class="w"></div>
            <div v-show="report_time_status"
                 style="background-color:#f44c54;height: 11px; width:  100px;position: fixed"></div>
            <div v-show="!tj_status" class="arrewall"></div>
            <div v-show="tj_status" style="background-color:#21c48f;height: 11.5px;" class="w"></div>
            <div v-show="tj_status" class="arrewall2"></div>

          </div>
        </div>
        <div style="display: flex; display: none">
          <div class="time" style="display: flex;font-weight: 800;justify-content: center; flex-grow: 1"><span>提交整改方案截止日期 {{
              ftime
            }}</span>
          </div>
          <div  class="time" style="display: flex;font-weight: 800;justify-content: center; flex-grow: 1"><span>提交整改报告截止日期 {{
              btime
            }}</span>
          </div>
        </div>
      </div>
    </div>
    <div class="content-box" style="margin-top: 100px">
      <div class="first-box">
        <div class="modules-box">
          <div>
            <img src="@/assets/import.png" alt="" class="lcimg">
            <img v-if="false" src="@/assets/complete.png"
                 style="position: absolute; float: right; height: 30px; width: 30px;right: 10px">
          </div>
          <p class="text-box">导入</p>
          <a-upload
            class="upload"
            ref="fileRef"
            :multiple="false"
            :file-list="fileList"
            :customRequest="customUpload"
            :before-upload="beforeFileUpload"
            :showUploadList="false"
            accept="zip"
          >
            <a-button>
              <a-icon type="upload" />
              导入
            </a-button>
            <a-tooltip>
              <template slot="title">
                仅支持上传zip格式的文件。
              </template>
              <a-icon type="question-circle" style="margin-left: 15px;color: orange;" />
            </a-tooltip>
          </a-upload>
        </div>
        <div class="arrow">
          <img src="@/assets/arrow.png" alt="" class="lcimg">
        </div>
        <div class="modules-box" @click="pathChange('/Feedback')">
          <div>
            <img src="@/assets/Feedback.png" alt="" class="lcimg">
            <img v-show="false" src="@/assets/complete.png"
                 style="position: absolute; float: right; height: 30px; width: 30px;right: 10px">
          </div>
          <p class="text-box">反馈意见</p>
        </div>
        <div class="arrow">
          <img src="@/assets/arrow.png" alt="" class="lcimg">
        </div>
        <div class="modules-box" @click="pathChange('/RectificationMeeting')">
          <div>
            <img src="@/assets/PublicityOfFeedback.png" alt="" class="lcimg">
            <img v-show="false" src="@/assets/complete.png"
                 style="position: absolute; float: right; height: 30px; width: 30px;right: 10px">
          </div>
          <p class="text-box">研究整改</p>
        </div>
        <div class="arrow">
          <img src="@/assets/arrow.png" alt="" class="lcimg">
        </div>
        <div class="modules-box" @click="pathChange('/RectificationPlan')">
          <div>
            <img src="@/assets/RectificationMeeting.png" alt="" class="lcimg">
            <img v-show="false" src="@/assets/complete.png"
                 style="position: absolute; float: right; height: 30px; width: 30px;right: 10px">
          </div>
          <p class="text-box">整改方案</p>
        </div>
      </div>
      <div class="center-box">
        <img src="@/assets/downarrow.png" alt="" />
      </div>
      <div class="second-box">
        <div class="modules-box" @click="pathChange('/RectificationLedger')">
          <div>
            <img src="@/assets/RectificationPlan.png" alt="" class="lcimg">
            <img v-show="false" src="@/assets/complete.png"
                 style="position: absolute; float: right; height: 30px; width: 30px;right: 10px">
          </div>
          <p class="text-box">整改台账</p>
        </div>
        <div class="arrow">
          <img src="@/assets/arrow.png" alt="" class="lcimg">
        </div>
        <div class="modules-box" @click="pathChange('/RectificationReport')">
          <div>
            <img src="@/assets/RectificationReport.png" alt="" class="lcimg">
            <img v-show="false" src="@/assets/complete.png"
                 style="position: absolute; float: right; height: 30px; width: 30px;right: 10px">
          </div>
          <p class="text-box">整改报告</p>
        </div>
        <div class="arrow">
          <img src="@/assets/arrow.png" alt="" class="lcimg">
        </div>
        <div class="modules-box" @click="pathChange('/PublicRectification')">
          <div>
            <img src="@/assets/PublicRectification.png" alt="" class="lcimg">
            <img v-show="false" src="@/assets/complete.png"
                 style="position: absolute; float: right; height: 30px; width: 30px;right: 10px">
          </div>
          <p class="text-box">整改公开</p>
        </div>
        <div class="arrow">
          <img src="@/assets/arrow.png" alt="" class="lcimg">
        </div>
        <div class="modules-box" @click="pathChange('/ImportAndExportRecords')">
          <div>
            <img src="@/assets/exprot.png" alt="" class="lcimg">
            <img v-show="false" src="@/assets/complete.png"
                 style="position: absolute; float: right; height: 30px; width: 30px;right: 10px">
          </div>
          <p class="text-box">导入导出记录</p>
        </div>
      </div>
    </div>
    <div class="footer"></div>
  </a-layout>
</template>

<script>
import {
  uploadFile,
  getRectifTimes,
  getPlanAndReportTimes,
  exportAlls,
  streamToBuffer,
  getRectificationMeeting,
  addRectificationMeeting,
  getImportAndExportRecords,
  getFeedback,
  getTmpleteteInfos,
  getRectification, getDateStr,
} from '@/utils/JsonTools';
import { saveAs } from 'file-saver';
import fs from 'fs';
import DateProgress from '@/components/DateProgress.vue';
import {getAllExtime, getFKSJ, getWarings, unzipFile} from '@/utils/fileUtils';
import eventBus from '@/utils/event';
//已完成
const green = 'linear-gradient(90deg,\n' +
  '    #3ae0a7 0%,\n' +
  '    #1fac8e 100%)';
//超期
const red = 'linear-gradient(90deg,\n' +
  '        #de2a3d 0%,\n' +
  '        #f44c54 100%)';
//范围内
const yellow = 'linear-gradient(90deg,\n' +
  '        #e8762a 0%,\n' +
  '        #fcaf37 100%)';
export default {
  name: 'HomeView',
  components: {
    DateProgress,
  },
  data() {
    return {
      tj_status:false,
      value: 80,
      ftime: '',
      btime: '',
      yjtime: '',
      fileList: [],
      fastauts: 0, // 0 ：大于5天  1：小于5天 2：已过期 3：已提交
      bgstatus: 0, // 0 ：大于5天  1：小于5天 2：已过期 3：已提交
      import_status: false,
      fkyj_status: false,
      yjzg_status: false,
      zgfa_status: false,
      zgtz_status: false,
      zgbg_status: false,
      zggk_status: false,
      export_status: false,
      fbgwidth: 442,
      bbgwidth: 442,
      fprocess: 0,
      bprocess: 0,
      ftip: '',
      btip: '',

      fbgcolor: yellow,
      bggcolor: green,
      fdotcolor: 1,
      bgdotcolor: 1,
      ftimeStr: '提交整改方案截止日期',
      btimeStr: '提交整改报告截止日期',
      report_time_status: false,
      fday: '',
      bday: '',
    };
  },
  mounted() {
    // this.$nextTick(s => {
    //   let styleEl = document.createElement('style')
    //   styleEl.innerHTML = '.img-jt {transform: rotate(45deg); background-color: transparent; display:inline-block;   border-color: #f02c57; border-style: solid; border-width: 5px 5px 0 0; height 20px;width: 20px}'
    //   document.head.appendChild(styleEl)
    //   // eslint-disable-next-line no-unused-vars
    //   let img = document.createElement('div')
    //   img.setAttribute('class', 'img-jt')
    //   img.style = '{transform: rotate(45deg); background-color: transparent; display:inline-block;   border-color: #f02c57; border-style: solid; border-width: 5px 5px 0 0; height 20px;width: 20px}'
    //   let silder = document.getElementsByClassName('ant-slider-handle')
    //   silder.appendChild(img)
    // })
    //this.getRectifTimes();
    this.rerfush();
    this.settimes();
  },
  methods: {
    // 上传验证
    beforeFileUpload(file) {
      let fileExt = file.name.slice(file.name.lastIndexOf('.') + 1);
      let fileTypeArr = ['zip'];
      if (fileTypeArr.indexOf(fileExt) === -1) {
        this.$message.error('非法的文件类型');
        return false;
      }
      return true;
    },
    customUpload(file) {

      unzipFile(file.file).then(res => {
        // eslint-disable-next-line eqeqeq
        if (res == 0) {
          this.$message.error('导入失败')
          return;
        }
        eventBus.emit('updatewhel')
        this.$message.success('导入成功')
        setTimeout(s => {
          this.rerfush()
          this.settimes()
        }, 1000);
      });
    },
    download(record) {

    },
    pathChange(e) {
      console.log('pathChange',this.$parent)
      this.$EventBus.$emit('menuChange',e)
      this.$router.push({ path: e }).catch(() => {
      });
    },
    rerfush() {
      // 导入导出
      this.getInAndOut();
      // 反馈意见
      this.yjfk();
      // 研究整改会议
      this.yjzg();
      // 整改台账
      this.zgtz();
      // 整改公开
      this.zggk();
    },
    settimes() {
      getWarings().then(res => {
        if (res.length > 0) {
          let count = 0;
          let count_r = 0;
          let plan_endtime=""
          let report_endtime=""
          let fksj=""
          this.ftimeStr = "提交整改方案截止日期"
          this.btimeStr = "提交整改报告截止日期"
          getFKSJ().then(sjres => {
            if (sjres.length > 0) {
              fksj=sjres[0].fksj
              if (res[0].F_PLAN_TYPE_.indexOf('week')> -1) {
                plan_endtime = getDateStr(sjres[0].fksj,res[0].F_PLAN_TIME_ , "2");
              }
              if (res[0].F_PLAN_TYPE_.indexOf('month')> -1) {
                plan_endtime = getDateStr(sjres[0].fksj,res[0].F_PLAN_TIME_ , "3");
              }
              if (res[0].F_PLAN_TYPE_.indexOf('day')> -1) {
                plan_endtime = getDateStr(sjres[0].fksj,res[0].F_PLAN_TIME_ , "1");
              }

              if (res[0].F_REPORT_TYPE_.indexOf('week')> -1) {
                report_endtime = getDateStr(sjres[0].fksj,res[0].F_REPORT_TIME_ , "2");
              }
              if (res[0].F_REPORT_TYPE_.indexOf('month')> -1) {
                report_endtime = getDateStr(sjres[0].fksj,res[0].F_REPORT_TIME_ , "3");
              }
              if (res[0].F_REPORT_TYPE_.indexOf('day')> -1) {
                report_endtime = getDateStr(sjres[0].fksj,res[0].F_REPORT_TIME_ , "1");
              }
              this.ftime = plan_endtime
              this.btime=report_endtime
              //计算当前进度占比
              try {
                //获取反馈意见
                getFeedback().then(fres=>{
                    if(fres.length>0) {
                      // let fatime = res.fgtime
                      // let bgtime = res.bgtime
                      // this.ftime = fatime
                      // this.btime = bgtime
                      //this.yjtime = "2023-09-29"
                      this.yjtime = fres[0].update_time
                      const res = getAllExtime()
                      if (res != undefined) {
                        res.bt=res.r_time
                        res.ft=res.f_time
                        if (res.bt !== undefined) {
                          this.zgbg_status = true
                        }
                        if (res.ft !== undefined) {
                          this.zgfa_status = true
                        }
                        if (this.ftime === undefined || this.btime === undefined) {
                          // this.$message.warn('系统未检测到单位数据，请确认是否已导入整改监督系统数据')
                          //return
                          // eslint-disable-next-line no-empty
                        } else {
                          this.ftimeStr = this.ftimeStr + ' ' + this.ftime
                          this.btimeStr = this.btimeStr + ' ' + this.btime
                        }
                        try {

                          // eslint-disable-next-line eqeqeq
                          let bgdays = this.GetDateDiff(res.bt == undefined ? this.formatDate(new Date(), 'Y-M-D') : res.bt, this.btime, 'day')
                          // eslint-disable-next-line eqeqeq
                          let fadays = this.GetDateDiff(res.ft == undefined ? this.formatDate(new Date(), 'Y-M-D') : res.ft, this.ftime, 'day')

                          let between =  this.GetDateDiff(this.ftime,this.formatDate(new Date(), 'Y-M-D'), 'day')
                          // 进度处理
                          let importTime = this.yjtime
                          console.log("fd---",fadays)
                          console.log("bd---",bgdays)
                          // 进度条颜色处理
                          // eslint-disable-next-line eqeqeq
                          if (res.bt != undefined) {
                            this.bggcolor = '#21c48f'
                            this.btip = '已提交'
                            this.bgdotcolor = 2
                            this.bprocess = this.bbgwidth
                            this.tj_status=true
                            // eslint-disable-next-line no-empty
                          } else {
                            // if(between > 0 || between == 0){
                              // eslint-disable-next-line eqeqeq
                              if (importTime != undefined && this.btime != undefined) {
                                console.log(this.ftime)
                                console.log('between=='+between)
                                // if(between > 0 || between ==0){
                                  let bgDif = this.GetDateDiff(this.formatDate(new Date(importTime), 'Y-M-D'), this.btime, 'day')
                                  let nowbgDif = this.GetDateDiff(this.formatDate(new Date(), 'Y-M-D'), this.btime, 'day')
                                  if (nowbgDif === 0 || nowbgDif < 0) {
                                    this.bprocess = this.bbgwidth
                                    // eslint-disable-next-line no-empty
                                  } else {

                                    let brate = (bgDif - nowbgDif) / bgDif
                                    this.bprocess = this.bbgwidth * brate
                                  }
                                // }
                              }
                              if (bgdays >= 5) {
                                // 大于5天为绿色
                                this.bgstatus = 0
                                this.bggcolor = '#21c48f'
                                this.btip = '剩余 ' + bgdays + '天'
                              }
                              if (bgdays < 5 && bgdays > 0) {
                                // 五天以内为黄色
                                this.bgstatus = 1
                                this.bggcolor = '#f9a836'
                                this.btip = '剩余 ' + bgdays + '天'
                              }
                              if (bgdays === 0) {
                                // 第五天为 为黄色
                                this.bgstatus = 1
                                this.bggcolor = '#f9a836'
                                this.bgdotcolor = 3
                                this.btip = '剩余 ' + bgdays + '天'
                              }
                              if (bgdays < 0) {
                                // 小于0天为红色
                                this.bgstatus = 2
                                this.bgdotcolor = 4
                                this.bggcolor = '#f44c54'
                                this.btip = '已超期 ' + Math.abs(bgdays) + '天'
                                this.report_time_status = true

                              }
                            // }
                          }
                          // eslint-disable-next-line eqeqeq
                          if (res.ft != undefined) {
                            this.fbgcolor = '#21c48f'
                            this.ftip = '已提交'
                            this.fdotcolor = 2
                            this.fprocess = this.fbgwidth
                            //this.fastauts = 3
                            // eslint-disable-next-line no-empty
                          } else {
                            // 方案时间差(截止时间-导入时间)
                            // 位移= （已过天/总天数）* 总宽度（232px，fbgwidth）
                            // eslint-disable-next-line eqeqeq
                            if (importTime != undefined && this.ftime != undefined) {
                              let faDif = this.GetDateDiff(this.formatDate(new Date(importTime), 'Y-M-D'), this.ftime, 'day')
                              let nowfaDef = this.GetDateDiff(this.formatDate(new Date(), 'Y-M-D'), this.ftime, 'day')
                              console.log("fdf-1--",nowfaDef)
                              if (nowfaDef === 0 || nowfaDef < 0 || faDif < 0) {
                                this.fprocess = this.fbgwidth
                                // eslint-disable-next-line no-empty
                              } else {
                                console.log(nowfaDef)
                                let frate = (faDif - nowfaDef) / faDif
                                console.log(frate)
                                this.fprocess = this.fbgwidth * frate
                              }
                            }
                            if (fadays >= 5) {
                              // 大于5天为绿色
                              this.bgstatus = 0
                              this.fbgcolor = '#21c48f'
                              this.ftip = '剩余 ' + fadays + '天'
                            }
                            if (fadays < 5 && fadays > 0) {
                              // 五天以内为黄色
                              this.bgstatus = 1
                              this.fbgcolor = '#f9a836'
                              this.ftip = '剩余 ' + fadays + '天'
                            }
                            if (fadays === 0) {
                              // 第五天为 为黄色
                              this.bgstatus = 1
                              this.fbgcolor = '#f9a836'
                              this.fdotcolor = 3
                              this.ftip = '剩余 ' + fadays + '天'
                            }
                            if (fadays < 0) {
                              // 小于0为红色
                              this.bgstatus = 2
                              this.fdotcolor = 4
                              this.fbgcolor = '#f44c54'
                              this.ftip = '已超期 ' + Math.abs(fadays) + '天'
                            }
                          }
                        } catch (e) {
                          console.log(e)
                        }
                      }
                    }
                })
              } catch (e) {
                console.log(e);
              }

            }
          });
        }
      });
    },
    getInAndOut() {
      getImportAndExportRecords().then(res => {
        // eslint-disable-next-line eqeqeq
        if (res != undefined && res.length > 0) {
          res.forEach(item => {
            // eslint-disable-next-line eqeqeq
            if (item.type == '导入') {
              //this.import_status = true;
            }
            // eslint-disable-next-line eqeqeq
            if (item.type == '导出' && item.module == '整改监督') {
              this.export_status = true;
            }
          });
        }
      });
    },
    yjfk() {
      // getFeedback().then(res => {
      //   // eslint-disable-next-line eqeqeq
      //   if (res != undefined && res.length > 0) {
      //    // this.fkyj_status = true;
      //   }
      // });
    },
    yjzg() {
      // getRectificationMeeting().then(res => {
      //   // eslint-disable-next-line eqeqeq
      //   if (res != undefined && res.length > 0) {
      //     //this.yjzg_status = true;
      //   }
      // });
    },
    zgtz() {
      // getTmpleteteInfos().then(res => {
      //   // eslint-disable-next-line eqeqeq
      //   if (res != undefined && res.length > 0) {
      //    // this.zgtz_status = true;
      //   }
      // });
    },
    zggk() {
      // getRectification().then(res => {
      //   // eslint-disable-next-line eqeqeq
      //   if (res != undefined && res.fileList != undefined && res.fileList.length > 0) {
      //   //  this.zggk_status = true;
      //   }
      // });
    },
    // getRectifTimes() {
    //     let fatime = res.fgtime;
    //     let bgtime = res.bgtime;
    //     this.ftime = fatime;
    //     this.btime = bgtime;
    //     this.yjtime = res.fyjtime;
    //     getPlanAndReportTimes().then(res => {
    //       // eslint-disable-next-line eqeqeq
    //       if (res != undefined) {
    //         if (res.bt !== undefined) {
    //           this.zgbg_status = true;
    //         }
    //         if (res.ft !== undefined) {
    //           //this.zgfa_status = true;
    //         }
    //         if (this.ftime === undefined || this.btime === undefined) {
    //           // this.$message.warn('系统未检测到单位数据，请确认是否已导入整改监督系统数据')
    //           // return
    //           // eslint-disable-next-line no-empty
    //         } else {
    //           this.ftimeStr = this.ftimeStr + ' ' + this.ftime;
    //           this.btimeStr = this.btimeStr + ' ' + this.btime;
    //         }
    //         try {
    //           console.log(res);
    //           // eslint-disable-next-line eqeqeq
    //           let bgdays = this.GetDateDiff(res.bt == undefined ? this.formatDate(new Date(), 'Y-M-D') : res.bt, this.btime, 'day');
    //           // eslint-disable-next-line eqeqeq
    //           let fadays = this.GetDateDiff(res.ft == undefined ? this.formatDate(new Date(), 'Y-M-D') : res.ft, this.ftime, 'day');
    //
    //           let between = this.GetDateDiff(this.ftime, this.formatDate(new Date(), 'Y-M-D'), 'day');
    //           // 进度处理
    //           let importTime = this.yjtime;
    //           console.log(fadays);
    //           console.log(bgdays);
    //           // 进度条颜色处理
    //           // eslint-disable-next-line eqeqeq
    //           if (res.bt != undefined) {
    //             this.bggcolor = green;
    //             this.btip = '已提交';
    //             this.bgdotcolor = 2;
    //             this.bprocess = this.bbgwidth;
    //             // eslint-disable-next-line no-empty
    //           } else {
    //             if (between > 0 || between == 0) {
    //               // eslint-disable-next-line eqeqeq
    //               if (importTime != undefined && this.btime != undefined) {
    //                 console.log(this.ftime);
    //                 console.log('between==' + between);
    //                 if (between > 0 || between == 0) {
    //                   let bgDif = this.GetDateDiff(this.formatDate(new Date(), 'Y-M-D'), this.btime, 'day');
    //                   alert(this.btime)
    //                   let nowbgDif = this.GetDateDiff(this.formatDate(new Date(), 'Y-M-D'), this.btime, 'day');
    //                   if (nowbgDif === 0 || nowbgDif < 0) {
    //                     this.bprocess = this.bbgwidth;
    //                     // eslint-disable-next-line no-empty
    //                   } else {
    //                     let brate = (bgDif - nowbgDif) / bgDif;
    //                    // alert(brate)
    //                     this.bprocess = this.bbgwidth * brate;
    //                   }
    //                 }
    //               }
    //               if (bgdays >= 5) {
    //                 // 大于5天为绿色
    //                 this.bgstatus = 0;
    //                 this.bggcolor = green;
    //                 this.btip = '剩余 ' + bgdays + '天';
    //               }
    //               if (bgdays < 5 && bgdays > 0) {
    //                 // 五天以内为黄色
    //                 this.bgstatus = 1;
    //                 this.bggcolor = yellow;
    //                 this.btip = '剩余 ' + bgdays + '天';
    //               }
    //               if (bgdays === 0) {
    //                 // 第五天为 为黄色
    //                 this.bgstatus = 1;
    //                 this.bggcolor = yellow;
    //                 this.bgdotcolor = 3;
    //                 this.btip = '剩余 ' + bgdays + '天';
    //               }
    //               if (bgdays < 0) {
    //                 // 小于0天为红色
    //                 this.bgstatus = 2;
    //                 this.bgdotcolor = 4;
    //                 this.bggcolor = red;
    //                 this.btip = '已超期 ' + Math.abs(bgdays) + '天';
    //                 this.report_time_status = true;
    //               }
    //             }
    //           }
    //           // eslint-disable-next-line eqeqeq
    //           if (res.ft != undefined) {
    //             this.fbgcolor = yellow;
    //             this.ftip = '已提交';
    //             this.fdotcolor = 2;
    //             this.fprocess = this.fbgwidth;
    //             //this.fastauts = 3
    //             // eslint-disable-next-line no-empty
    //           } else {
    //             // 方案时间差(截止时间-导入时间)
    //             // 位移= （已过天/总天数）* 总宽度（232px，fbgwidth）
    //             // eslint-disable-next-line eqeqeq
    //             if (importTime != undefined && this.ftime != undefined) {
    //               let faDif = this.GetDateDiff(this.formatDate(new Date(importTime), 'Y-M-D'), this.ftime, 'day');
    //               let nowfaDef = this.GetDateDiff(this.formatDate(new Date(), 'Y-M-D'), this.ftime, 'day');
    //               console.log(faDif);
    //               if (nowfaDef === 0 || nowfaDef < 0 || faDif < 0) {
    //                 this.fprocess = this.fbgwidth;
    //                 // eslint-disable-next-line no-empty
    //               } else {
    //                 console.log(nowfaDef);
    //                 let frate = (faDif - nowfaDef) / faDif;
    //                 console.log(frate);
    //                 this.fprocess = this.fbgwidth * frate;
    //               }
    //             }
    //             if (fadays >= 5) {
    //               // 大于5天为绿色
    //               this.bgstatus = 0;
    //               this.fbgcolor = green;
    //               this.ftip = '剩余 ' + fadays + '天';
    //             }
    //             if (fadays < 5 && fadays > 0) {
    //               // 五天以内为黄色
    //               this.bgstatus = 1;
    //               this.fbgcolor = yellow;
    //               this.ftip = '剩余 ' + fadays + '天';
    //             }
    //             if (fadays === 0) {
    //               // 第五天为 为黄色
    //               this.bgstatus = 1;
    //               this.fbgcolor = yellow;
    //               this.fdotcolor = 3;
    //               this.ftip = '剩余 ' + fadays + '天';
    //             }
    //             if (fadays < 0) {
    //               // 小于0为红色
    //               this.bgstatus = 2;
    //               this.fdotcolor = 4;
    //               this.fbgcolor = red;
    //               this.ftip = '已超期 ' + Math.abs(fadays) + '天';
    //             }
    //           }
    //         } catch (e) {
    //           console.log(e);
    //         }
    //       }
    //     });
    // },
    /**
     * 格式化日期
     * @param {string | number | Date} value 指定日期
     * @param {string} format 格式化的规则
     * @example
     * ```js
     * formatDate();
     * formatDate(1603264465956);
     * formatDate(1603264465956, "h:m:s");
     * formatDate(1603264465956, "Y年M月D日");
     * ```
     */
    formatDate(value, format) {
      const formatNumber = n => `0${n}`.slice(-2);
      const date = value;
      const formatList = ['Y', 'M', 'D', 'h', 'm', 's'];
      const resultList = [];
      resultList.push(date.getFullYear().toString());
      resultList.push(formatNumber(date.getMonth() + 1));
      resultList.push(formatNumber(date.getDate()));
      resultList.push(formatNumber(date.getHours()));
      resultList.push(formatNumber(date.getMinutes()));
      resultList.push(formatNumber(date.getSeconds()));
      for (let i = 0; i < resultList.length; i++) {
        format = format.replace(formatList[i], resultList[i]);
      }
      return format;
    },
    exportAll() {
      // 导出提报
      // eslint-disable-next-line no-undef
      exportAlls().then(res => {
        // eslint-disable-next-line eqeqeq
        if (res.status == 0) {
          this.$message.error('导出失败');
        } else {
          console.log(res);
          let fileb = fs.createReadStream(res.path);
          let fsname = res.fname;
          console.log('fsname-----' + fsname);
          streamToBuffer(fileb).then(res => {
            let data = res;
            let contents = new Uint8Array(data.length);
            for (let i = 0; i < data.length; i++) {
              contents[i] = data[i];
            }
            // eslint-disable-next-line no-undef
            let expname = fsname.replace(/[\d]+/, this.getcurDate());
            saveAs.saveAs(new Blob([contents], { type: 'application/zip' }), expname);
          });
          this.$message.success('导出成功');
        }
      });
    },
    getPublicMeetings() {
      addRectificationMeeting().then(res => {
        // eslint-disable-next-line eqeqeq,no-empty
        if (res != undefined && res.length > 0) {
          // 研究整改完成状态判断
          //  this.yjzg_status = true;
        }
      });
    },
    getcurDate() {
      let currentDate = new Date();
      let year = currentDate.getFullYear().toString();
      let month = (currentDate.getMonth() + 1).toString();
      if (month.length === 1) {
        month = '0' + month;
      }
      let date = currentDate.getDate().toString();
      if (date.length === 1) {
        date = '0' + date;
      }
      let hour = currentDate.getHours().toString();
      if (hour.length === 1) {
        hour = '0' + hour;
      }
      let minute = currentDate.getMinutes().toString();
      if (minute.length === 1) {
        minute = '0' + minute;
      }
      let second = currentDate.getSeconds().toString();
      if (second.length === 1) {
        second = '0' + second;
      }
      return year + '-' + month + '-' + date + ' ' + hour + ':' + minute + ':' + second;
    },
    GetDateDiff(startTime, endTime, diffType) {
      // 将xxxx-xx-xx的时间格式，转换为 xxxx/xx/xx的格式

      startTime = startTime.replace('-', '/');

      endTime = endTime.replace('-', '/');

      // 将计算间隔类性字符转换为小写

      //  diffType = diffType.toLowerCase()

      let sTime = new Date(startTime); // 开始时间

      let eTime = new Date(endTime); // 结束时间

      // 作为除数的数字

      let divNum = 1;

      switch (diffType) {
        case 'second':

          divNum = 1000;

          break;

        case 'minute':

          divNum = 1000 * 60;

          break;

        case 'hour':

          divNum = 1000 * 3600;

          break;

        case 'day':

          divNum = 1000 * 3600 * 24;

          break;

        default:

          break;
      }

      return parseInt((eTime.getTime() - sTime.getTime()) / parseInt(divNum));
    },
  },
};
</script>
<style lang="scss" scoped>
.pd30{
  padding-left: 30px
}
.h-warning {

  span {
    height: 28px;
    font-family: PingFangSC-Regular;
    font-size: 20px;
    font-weight: normal;
    font-stretch: normal;
    letter-spacing: 0px;
    color: #333333;
    position: absolute;
  }

  .lable1 {
   /* left: 0px;*/
    margin-left: -85px;
    width: 230px;
  }

  .lable2 {
   /* left: 485px;*/
    margin-left: 385px;
    width: 230px;
  }
}

.ant-layout {
  background-image: linear-gradient(180deg, #ffffff 0%, #f4f7ff 45%, #f4f7ff 100%), linear-gradient(#ffffff, #ffffff);
}

.content-box {
  width: 80%;
  margin: 40px auto 0 auto;

  .first-box {
    display: flex;
    justify-content: space-between;
  }

  .second-box {
    display: flex;
    flex-direction: row-reverse;
    justify-content: space-between;

    .arrow {
      transform: rotateY(180deg);
    }
  }

  .modules-box {
    width: 14%;
    cursor: pointer;
    position: relative;

    img {
      width: 100%;
    }
  }

  .arrow {
    width: 14%;
    margin-top: 2.5%;

    img {
      width: 100%;
    }
  }

  .mtr {
    margin-top: 50px;
  }

  .text-box {
    position: relative;
    top: -20px;
    background: linear-gradient(180deg, #81e1ff 0%, #3277ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 24px;
    font-weight: bold;
  }

  .center-box {
    overflow: hidden;
    margin-bottom: 20px;

    img {
      display: block;
      float: right;
      margin-right: 6%;
    }
  }
}

.footer {
  width: 90%;
  margin: auto;
  height: 180px;
  background: url("~@/assets/footer.png");
  background-size: 100% 100%;
}

.upload {
  opacity: 0;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

::v-deep .ant-upload {
  width: 100%;
  height: 100%;

  .ant-btn {
    width: 100%;
    height: 100%;
  }

}

::v-deep .ant-slider {
  height: 24px;
}

::v-deep .ant-slider-handle {
  display: inline-block;
  position: absolute;
  width: 20px;
  height: 20px;
  margin-top: -5px;
  border-radius: 0;

  cursor: pointer;

  width: 14px;

  height: 14px;

  background-color: transparent; /* 模块背景为透明 */

  border-color: #f02c57;

  border-style: solid;

  margin: -6px auto;
}

</style>
<style scoped>
.lcimg {
  margin-top: 10px;
}
.w{
  width: 442px;
}
.time{
    height: 31px;
    font-family: PingFangSC-Semibold;
    font-size: 22px;
    font-weight: normal;
    font-stretch: normal;
    letter-spacing: 0px;
    color: #333333;
}
.arrewall {
  position: relative;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 20px 0 20px 20px;
  border-color: transparent transparent transparent #d8d8d8;
}
.arrewall2 {
  position: relative;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 20px 0 20px 20px;
  border-color: transparent transparent transparent #21c48f;
}

</style>
